const path = require('path')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const htmlPlugin = new HtmlWebpackPlugin({
    template: './src/index.html',
    filename: 'index.html'

})
const VueLoaderPlugin = require('vue-loader/lib/plugin')


module.exports ={
    mode: 'development',
    entry: path.join(__dirname, './src/index.js'),//入口文件的路径
    output: {
        path: path.join(__dirname, './dist'),//输出文件的路径
        filename: 'bundle.js'//输出文件的名称
    },
    plugins: [htmlPlugin, new VueLoaderPlugin()],
    module: {
        rules: [
            { test: /\.css$/, use: ['style-loader', 'css-loader', 'postcss-loader']},//postcss-loader自动为css加后缀兼容浏览器
            { test: /\.less$/, use: ['style-loader', 'css-loader', 'less-loader']},
            { test: /\.scss$/, use: ['style-loader', 'css-loader', 'sass-loader']},
            { test: /\.jpg|png|gif|bmp|ttf|eot|svg|woff|woff2$/, use: 'url-loader?limit=1080'},//图片字节大于或等于limit图片不会转base64
            { test: /.js$/, use: 'babel-loader',exclude: /node_modules/},
            { test: /.vue$/, use: ['vue-loader']}
        ]
    }
}